package com.neudu.ssrs_yyzxservice.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.neudu.ssrs_yyzxservice.mapper.BackdownMapper;
import com.neudu.ssrs_yyzxservice.pojo.Backdown;
import com.neudu.ssrs_yyzxservice.service.BackdownService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BackdownServiceImpl implements BackdownService {

    @Autowired
    private BackdownMapper backdownMapper;

    @Override
    public PageInfo<Backdown> getAllBackdowns(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Backdown> list = backdownMapper.selectList(null);
        return new PageInfo<>(list);
    }

    @Override
    public Backdown getBackdownById(Integer id) {
        return backdownMapper.selectById(id);
    }

    @Override
    public void addBackdown(Backdown backdown) {
        backdownMapper.insert(backdown);
    }

    @Override
    public void updateBackdown(Backdown backdown) {
        backdownMapper.updateById(backdown);
    }

    @Override
    public void deleteBackdownById(Integer id) {
        backdownMapper.deleteById(id);
    }

}